layui.use(['form', 'jquery', 'jquery_cookie'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.jquery,
        $ = layui.jquery_cookie($);
    form.on('submit(saveBtn)', function (data) {
        console.log(data.field)
        $.ajax({
            type: "post",
            url: ctx + "/emp/password",
            data: {
                empId: data.field.empId,
                oldPassword: data.field.oldPassword,
                newPassword: data.field.newPassword,
                againPassword: data.field.againPassword
            },
            success: function (data) {
                if (data.code == 200) {
                    layer.msg("用户密码修改成功 ， 将在3秒后退出", {time: 3000, icon: 6}, function () {
                        $.removeCookie("rememberMe", {domain: "localhost", path: "/erp"})
                        window.parent.location.href = ctx + "/index"
                    })
                } else {
                    layer.msg(data.msg)
                }
            },
            error: function (data) {
                layer.msg(data.msg)
            }


        })


    })


})